package com.jcnet.bizaia.fragment;

import com.jcnet.bizaia.App;
import com.jcnet.bizaia.R;
import com.jcnet.bizaia.bean.TeacherInfoBean;
import com.squareup.picasso.Picasso;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Html;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
/**
 * @author chenguandong
 * @serial   讲师详细
 */
public final class TeacherDetailFragment extends Fragment {
    private static final String KEY_CONTENT = "TestFragment:Content";

    private TeacherInfoBean chaLecturerJson;
    public static TeacherDetailFragment newInstance( TeacherInfoBean chaLecturerJson) {
        TeacherDetailFragment fragment = new TeacherDetailFragment();

       // fragment.mContent = builder.toString();
        fragment.chaLecturerJson = chaLecturerJson;
        return fragment;
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) {
            //mContent = savedInstanceState.getString(KEY_CONTENT);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
       View view = View.inflate(getActivity(), R.layout.teacher_info, null);
      ((TextView) view.findViewById(R.id.teacherName)).setText(chaLecturerJson.getLtname());
      ((TextView) view.findViewById(R.id.teacherNikeName)).setText(chaLecturerJson.getLtpost());
      ((TextView) view.findViewById(R.id.teacherInfoTextView)).setText(chaLecturerJson.getLtintro());
      Picasso.with(getActivity()).load(App.HTTP_PATH+chaLecturerJson.getLtimages()).centerCrop().resize(150	, 180).into((ImageView)view.findViewById(R.id.teacherIMG));
      
        return view;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
       // outState.putString(KEY_CONTENT, mContent);
    }
}
